package com.android.demolayoutpages;

import com.android.demolayoutpages.R;
import com.android.demolayoutpages.R.id;
import com.android.demolayoutpages.R.layout;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CategoryAdapter extends BaseAdapter {

	private Context context;

	public CategoryAdapter(Context context) {
		this.context = context;

	}

	@Override
	public int getCount() {
		return 5;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		ViewHolder holder  ;

		if (convertView == null) {

			holder = new ViewHolder();
			convertView = inflater.inflate(R.layout.row_category, null);
			convertView.setMinimumHeight(50);
			holder.tvCategoryName = (TextView) convertView.findViewById(R.id.txt_categoryName);
			convertView.setTag(holder);

		}else {
			holder = (ViewHolder) convertView.getTag();

		}

		holder.tvCategoryName.setText("loose weight");

		return convertView;
	}
	class ViewHolder{

		TextView tvCategoryName;

	}
}
